<?php

/**
 * Description of Application_Model_Fields_Json
 *
 * @author Jean Brito
 */
class Application_Model_Fields_Json extends Application_Model_Fields_Abstract {

	public function getSqlWhere($value=''){
		return "(".$this->getSqlFieldName()." like '%".$value."%')";
	}

	public function getSqlSet(array $value=array()){
		return "'".Zend_Json::encode($value)."'";
	}
	public function getSqlValue($row=array()){
		$value=trim(str_replace("\t","",str_replace("\n","",$row[$this->_name])));
		if($value=='')return array();
		return Zend_Json::decode($value);
	}
	
}
